ISOLATION LEVEL SERIALIZABLE - Mailing list pgsql-general

From power2themacs
Subject ISOLATION LEVEL SERIALIZABLE
Date
Msg-id a0510140eb8c670c2fda0@[128.2.161.124]
Whole thread Raw
Responses Re: ISOLATION LEVEL SERIALIZABLE  (Darren Ferguson <darren@crystalballinc.com>)
List pgsql-general
I am using 7.2 and JDBC. I have a very simple situation where I
insert an item with a primary key which is a SERIAL. In the same
transaction I need to insert a reference in a separate table to this
item. Of course, race conditions could occur if I didn't use this
special isolation level. But is there no way in which I could use
row-level locking instead? Certainly, I am not updating the table I
just inserted to, so the FOR UPDATE would never unlock. Is the
isolation level my only option? I noticed that psql displays the oid
after an INSERT. That would be exactly what I need but JDBC doesn't
seem to offer this.

(Right now I set the isolation level and just get the SERIAL's current value.)

|---table1----------------|   |---table2-----------------|
| id SERIAL PRIMARY KEY    |  | id SERIAL REFERNCES table1 |


Short version:
I just inserted into table1 and need these in the same transaction.
How can I get the id I just inserted into table2? Thanks folks.
--
><><><><><><><><><><><><
power2themacs@yahoo.com

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


pgsql-general by date:

Previous
From: Justin Clift
Date:
Subject: Re: Performance in subconsult
Next
From: "PG Explorer"
Date:
Subject: Re: ISOLATION LEVEL SERIALIZABLE